package com.example.testapplication.adapter;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import java.util.ArrayList;

public class CartMainAdapter extends FragmentPagerAdapter {

    private String[] mTitles;
    private ArrayList<Fragment> fragments;

    public CartMainAdapter(@NonNull FragmentManager fm, String[] titles, ArrayList<Fragment> fragmentArrayList) {
        super(fm);
        this.mTitles=titles;
        this.fragments=fragmentArrayList;
    }

    @Override
    public int getCount() {
        return fragments.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return mTitles[position];
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }
}
